<table><tr><td>
<% if !player.nil? && (player_id.nil? || player.id.to_s == player_id) %>
	<% 
	clubs = player.cards.select{|c| c.suit == 'c'}.sort_by{|c| c.value}
	diamonds = player.cards.select{|c| c.suit == 'd'}.sort_by{|c| c.value}
	hearts = player.cards.select{|c| c.suit == 'h'}.sort_by{|c| c.value}
	spades = player.cards.select{|c| c.suit == 's'}.sort_by{|c| c.value}
	%>

	<table>
	<% [clubs.size, diamonds.size, hearts.size, spades.size].max.times do |a| %>
	<tr>
	<% if player.id == player.game.active_player_id && player.game.contract_final%>
	<td><%=clubs[a].nil? ? " " : (link_to clubs[a].pp, play_card_path(player.game.id, player.id, clubs[a].id)) %></td>
	<td><%=diamonds[a].nil? ? " " : (link_to diamonds[a].pp, play_card_path(player.game.id, player.id, diamonds[a].id)) %></td>
	<td><%=hearts[a].nil? ? " " :  (link_to hearts[a].pp, play_card_path(player.game.id, player.id, hearts[a].id)) %></td>
	<td><%=spades[a].nil? ? " " :  (link_to spades[a].pp, play_card_path(player.game.id, player.id, spades[a].id)) %></td></tr>
	<% else %>
	<td><%=clubs[a].nil? ? " " : clubs[a].pp%></td>
	<td><%=diamonds[a].nil? ? " " : diamonds[a].pp%></td>
	<td><%=hearts[a].nil? ? " " : hearts[a].pp%></td>
	<td><%=spades[a].nil? ? " " : spades[a].pp%></td></tr>
	<% end %>
	<%end%>
	</table>
<% end %>
</td></tr>
<tr><td>
	<%=render :partial => 'player_bids', :locals => {:player => player}%> 
</td></tr>
</table>

